<html xmlns="http://www.w3.org/1999/xhtml"
      lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link th:href="@{/erp/assets/css/bootstrap.min.css}" rel="stylesheet"/>
    <link rel="stylesheet" th:href="@{/erp/css/style.css}"/>
    <link th:href="@{/erp/assets/css/codemirror.css}" rel="stylesheet">
    <link rel="stylesheet" th:href="@{/erp/assets/css/ace.min.css}"/>
    <link rel="stylesheet" th:href="@{/erp/assets/css/font-awesome.min.css}"/>
    <!--[if IE 7]>
    <link rel="stylesheet" th:href="@{/erp/assets/css/font-awesome-ie7.min.css}"/>
    <![endif]-->
    <!--[if lte IE 8]>
    <link rel="stylesheet" th:href="@{/erp/assets/css/ace-ie.min.css}"/>
    <![endif]-->


    <script type="text/javascript"
            src="http://api.map.baidu.com/api?v=2.0&ak=YNnrbmm4DgiiZGVdPaldXOGhGKZ9iGeG"></script>
    <!--<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>-->
    <script th:src="@{/erp/js/jquery-1.9.1.min.js}"></script>
    <script th:src="@{/erp/assets/js/bootstrap.min.js}"></script>
    <script th:src="@{/erp/assets/js/typeahead-bs2.min.js}"></script>
    <script th:src="@{/erp/assets/layer/layer.js}" type="text/javascript"></script>
    <script th:src="@{/erp/assets/js/jquery-ui-1.10.3.custom.min.js}"></script>
    <script th:src="@{/erp/assets/js/jquery.ui.touch-punch.min.js}"></script>
    <script th:src="@{/erp/assets/js/ace-elements.min.js}"></script>
    <script th:src="@{/erp/assets/js/ace.min.js}"></script>
    <script th:src="@{/erp/assets/laydate/laydate.js}" type="text/javascript"></script>
    <script type="text/javascript" th:src="@{/erp/Widget/ueditor/1.4.3/ueditor.config.js}"></script>
    <script type="text/javascript" th:src="@{/erp/Widget/ueditor/1.4.3/ueditor.all.min.js}"></script>
    <script type="text/javascript" th:src="@{/erp/Widget/ueditor/1.4.3/lang/zh-cn/zh-cn.js}"></script>
    <style type="text/css">

        #preview {
            width: 100px;
            height: 100px;
            border: 1px solid #000;
            overflow: hidden;
        }

        #imghead {
            filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);
        }
    </style>
    <title>用户中心</title>

</head>
<body>
<div class="margin clearfix">
    <div class="stystems_style">
        <div class="tabbable">
            <ul class="nav nav-tabs" id="myTab">
                <li class="active">
                    <a data-toggle="tab" href="#newdropdown"><i class="green fa fa-home bigger-110"></i>&nbsp;企业信息</a>
                </li>
                <li class="">
                    <a data-toggle="tab" href="#home">&nbsp;基本设置</a>
                </li>
                <!--  <li class="">
                    <a data-toggle="tab"  href="#homerr">&nbsp;地理位置</a>
                  </li>-->
            </ul>

            <div class="tab-content">
                <div id="home" class="tab-pane">
                    <form style="display: none" id="head-form">
                        <input type="file" name="file" id="imghead2">
                    </form>
                    <form action="/admininfo/update" onsubmit="return sure()" method="post">
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right" for="imghead">企业图标： </label>
                            <div id="preview" style="margin-left:150px; border: none">
                                <img id="imghead" width=80 height=80 border=0 th:src='${userAndCompany.company_image}'>
                                <input name="companyImage" type="hidden" id="headImg">
                            </div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i>*</i>用户账号：
                        </label>
                            <div class="col-sm-9"><span name="userName" type="text" id="用户账号"
                                                         th:text=" ${userAndCompany.user_name}" style=" width:300px"
                                                         class="col-xs-10" onkeyup='this.value=this.value.replace(/\W/,"")'/></div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i>*</i>公司名称：
                        </label>
                            <div class="col-sm-9"><span name="companyName" type="text" id="公司名称" th:text="${userAndCompany.company_name}"
                                                         style=" width:300px" class="col-xs-10 "/></div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i>*</i>公司品牌：
                        </label>
                            <div class="col-sm-9"><input name="companyBrand" type="text" id="公司品牌" th:value="${userAndCompany.company_brand}"
                                                         style="width:300px"
                                                         class="col-xs-10 " maxlength="50"></div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right">公司类型： </label>
                            <div class="col-sm-9">
                         <span class="formControls col-4">
                             <select name="companyType" style="width:300px" class="form-control" id="form-field-select-1">
                                 <option th:text="${userAndCompany.company_type}" th:value="${userAndCompany.company_type}"></option>
                                 <option value="个企">个企</option>
                                 <option value="国营">国营</option>
                                 <option value="跨国">跨国</option>
                             </select>
                         </span>
                            </div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right">经营范围： </label>
                            <div class="col-sm-9"><input name="businessScope" type="text" id="经营范围"
                                                         th:value="${userAndCompany.business_scope}"
                                                         style=" width:300px" class="col-xs-10" maxlength="50"></div>
                        </div>

                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right">公司规模： </label>
                            <div class="col-sm-9"><input name="companyScale" type="text" id="公司规模"
                                                         th:value="${userAndCompany.company_scale}" style=" width:300px"
                                                         class="col-xs-10" maxlength="50">&nbsp;&nbsp;
                            </div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right">法人姓名： </label>
                            <div class="col-sm-9"><input name="legal" type="text" id="法人姓名" th:value="${userAndCompany.legal}"
                                                         style=" width:300px" class="col-xs-10"><span style="color: red;display: none" id="lespan">只能中文或英文</span></div>
                        </div>

                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i>*</i>固定电话：
                        </label>
                            <div class="col-sm-9"><input name="fixedTel" type="text" id="固定电话" th:value="${userAndCompany.fixed_tel}"
                                                         style=" width:300px" class="col-xs-10" ><span style="color: red;display: none" id="fspan">电话错误</span></div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i>*</i>法人电话：
                        </label>
                            <div class="col-sm-9"><input name="legalTel"type="text" id="法人电话" placeholder=""
                                                         th:value="${userAndCompany.legal_tel}" style=" width:300px"
                                                         class="col-xs-10" oninput="value=value.replace(/[^\d]/g,'')"><span style="color: red;display: none" id="lspan">手机号错误</span></div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i>*</i>QQ号：
                        </label>
                            <div class="col-sm-9"><input name="companyQq" type="text" id="QQ号" placeholder=""
                                                         th:value="${userAndCompany.company_qq}" style=" width:300px"
                                                         class="col-xs-10" oninput="value=value.replace(/[^\d]/g,'')"><span style="color: red;display: none" id="qspan">qq号错误</span></div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i>*</i>微信号：
                        </label>
                            <div class="col-sm-9"><input name="companyWechat" type="text" id="微信号" placeholder=""
                                                         th:value="${userAndCompany.company_wechat}"
                                                         style=" width:300px" class="col-xs-10" maxlength="10"></div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i>*</i>公司邮箱：
                        </label>
                            <div class="col-sm-9"><input name="companyEmail" type="text" id="公司邮箱" placeholder=""
                                                         th:value="${userAndCompany.company_email}" style=" width:300px"
                                                         class="col-xs-10 "><span style="color: red;display: none" id="espan">邮箱错误</span></div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i>*</i>用户手机号：
                        </label>
                            <div class="col-sm-9"><input name="userTel" type="text" id="用户手机号" placeholder=""
                                                         th:value="${userAndCompany.user_tel}" style=" width:300px"
                                                         class="col-xs-10" oninput="value=value.replace(/[^\d]/g,'')"><span style="color: red;display: none" id="uspan">手机号错误</span></div>
                        </div>

                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i>*</i>选择地区：
                        </label>
                            <div class="col-sm-9">
                                <span class="formControls col-4" style=" width:100px">
		                             <select style=" width:90px" class="form-control" id="province" name="companyProvince" onchange="chooseProvince(this)">
                                         <option  th:text="${userAndCompany.company_province}"></option>
                                     </select>
		                        </span>

                                <span class="formControls col-4" style=" width:100px">
		                             <select style=" width:90px" class="form-control" id="city" name="companyCity" onchange="chooseCity(this)">
                                         <option  th:text="${userAndCompany.company_city}"></option>
                                    </select>
		                        </span>

                                <span class="formControls col-4" style=" width:100px">
		                              <select style=" width:90px" class="form-control" id="area" name="companyArea">
                                         <option  th:text="${userAndCompany.company_area}"></option>
                                      </select>
		                        </span>
                            </div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i>*</i>详细地址：
                        </label>
                            <div class="col-sm-9"><input name="companyAddress"  type="text" id="website-title" placeholder=""
                                                         th:value="${userAndCompany.company_address}"
                                                         style=" width:300px" class="col-xs-10 " maxlength="50"></div>
                        </div>
                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right">经纬度： </label>
                            <div class="col-sm-9"><input name="longitudeLatitude" type="text" id="result_"
                                                         th:value="${userAndCompany.longitude_latitude}"
                                                         style=" width:300px;" class="col-xs-10">

                                <label style="width:260px"> &nbsp;&nbsp;&nbsp;&nbsp;输入地址：<input id="text_" type="text"
                                                                                                value="中国"/></label>
                                <input type="button" value="查询" class="btn btn-xs btn-info"
                                       onClick="searchByStationName();"/>
                            </div>
                        </div>

                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right">经纬度选择： </label>
                            <div class="col-sm-9">
                                <div id="container"
                                     style="position: absolute;
                             margin-top:10px; 
							 margin-left:10px;
                            width: 800px; 
                             height: 500px;

                           border: 1px solid gray;
                             overflow:hidden;">
                                </div>
                            </div>
                        </div>

                        </br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br>


                        <div class="form-group"><label class="col-sm-1 control-label no-padding-right"><i></i>企业简介：
                        </label>
                            <div class="col-sm-9">
		     <span class="formControls col-10" style="margin-left:10px;width:800px;height: 300px;">
		        <!--<script th:name="companyIntroduction" id="editor" type="text/plain" style="width:100%;height:200px;"
                        th:text="${userAndCompany.company_introduction}" ></script>-->
                 <script name="companyIntroduction" id="editor" type="text/plain" style="width:100%;height:200px;"
                          ></script>
            </span>
                            </div>
                        </div>
                        <input hidden="hidden" th:value="${userAndCompany.company_introduction}" id="premarks">
                        <br/> <br/>

                        <div class="Button_operation">

                            <input class="btn btn-primary radius" type="submit" value="保存"></input>

                            <button onclick="tiaozzz()" class="btn btn-default radius" type="button">&nbsp;&nbsp;返回&nbsp;&nbsp;</button>
                        </div>
                    </form>

                </div>


                <div id="newdropdown" class="tab-pane active">
                    <div class="detailed_style clearfix">
                        <em class=""></em>

                        <div class="shop_logo"><img height="180" width="180" id="cimage" th:src="${userAndCompany.company_image}"/><br/>
                        </div>
                        <ul class="shop_content clearfix">
                            <li class="shop_name"><label class="label_name">用户账户：</label><span class="info"
                                                                                               th:text="${userAndCompany.user_name}"></span>
                            </li>
                            <li class="shop_name"><label class="label_name">公司名称：</label><span class="info"
                                                                                               th:text="${userAndCompany.company_name}"></span>
                            </li>
                            <li><label class="label_name">公司品牌：</label><span class="info"
                                                                             th:text="${userAndCompany.company_brand}"></span>
                            </li>
                            <li><label class="label_name">公司类型：</label><span class="info"
                                                                             th:text="${userAndCompany.company_type}"></span>
                            </li>
                            <li><label class="label_name">公司规模：</label><span class="info"
                                                                             th:text="${userAndCompany.company_scale}"></span>
                            </li>
                            <li><label class="label_name">经营范围：</label><span class="info"
                                                                             th:text="${userAndCompany.business_scope}"></span>
                            </li>
                            <li><label class="label_name">注册时间：</label><span class="info"
                                                                             th:text="${userAndCompany.creat_time}"></span>
                            </li>
                            <li><label class="label_name">法人姓名：</label><span class="info"
                                                                             th:text="${userAndCompany.legal}"></span>
                            </li>
                            <li><label class="label_name">电子邮箱：</label><span class="info"
                                                                             th:text="${userAndCompany.company_email}"></span>
                            </li>
                            <li><label class="label_name">法人手机：</label><span class="info"
                                                                             th:text="${userAndCompany.legal_tel}"></span>
                            </li>
                            <li><label class="label_name">固定电话：</label><span class="info"
                                                                             th:text="${userAndCompany.fixed_tel}"></span>
                            </li>
                            <li><label class="label_name">详细地址：</label><span class="info"
                                                                             th:text="${userAndCompany.company_address}"></span>
                            </li>
                            <li><label class="label_name">经纬度：</label><span class="info"
                                                                            th:text="${userAndCompany.longitude_latitude}"></span>
                            </li>
                        </ul>
                    </div>
                    <br/><br/><br/><br/>
                    <input hidden="hidden" th:value="${userAndCompany.company_introduction}" id="companyIntroduction">
                    <div class="Store_Introduction">
                        <div class="title_name">企业简介</div>
                        <div class="info"><br/>
                            <span id="b"></span>
                            <div id="a" style="display: none" th:text="${userAndCompany.company_introduction}"></div>
                        </div>
                    </div>
<!--
                    <input type="text" th:value="${userAndCompany.company_introduction}" id="aaa">
-->
                    <div class="state-overview clearfix">
                        <div class="col-lg-3 col-sm-6">
                            <section class="panel">
                                <a href="#" title="商城会员">
                                    <div class="symbol terques">
                                        <i class="icon-shopping-cart"></i>
                                    </div>
                                    <div class="value">
                                        <h1>390</h1>
                                        <p>累计订单</p>
                                    </div>
                                </a>
                            </section>
                        </div>

                        <div class="col-lg-3 col-sm-6">
                            <section class="panel">
                                <div class="symbol yellow">
                                    <i class="icon-shopping-cart"></i>
                                </div>
                                <div class="value">
                                    <h1>345</h1>
                                    <p>客户销售订单</p>
                                </div>
                            </section>
                        </div>
                        <div class="col-lg-3 col-sm-6">
                            <section class="panel">
                                <div class="symbol blue">
                                    <i class="icon-bar-chart"></i>
                                </div>
                                <div class="value" title="按累计订单排名">
                                    <h1>3</h1>
                                    <p>活跃度排名</p>
                                </div>
                            </section>
                        </div>
                    </div>
                </div>



            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('#b').empty().append($('#a').text());
    })

 $('#法人姓名').on('change', function() {

     var legal =/^[\u4e00-\u9fa5_a-zA-Z]+$/;
     if(!legal.test($("input[name='legal']").val())){
         $("#lespan").show();
     }
     if(legal.test($("input[name='legal']").val())){
         $("#lespan").css("display","none");
     }
 })

    $('#法人电话').on('change', function() {
        var tel = /^1([38]\d|5[0-35-9]|7[3678])\d{8}$/;
        if (!tel.test($("input[name='legalTel']").val())) {
            $("#lspan").show();
        }
        if (tel.test($("input[name='legalTel']").val())) {
            $("#lspan").css("display", "none");
        }
    })

    $('#用户手机号').on('change', function() {
        var tel = /^1([38]\d|5[0-35-9]|7[3678])\d{8}$/;
        if (!tel.test($("input[name='userTel']").val())) {
            $("#uspan").show();
        }
        if (tel.test($("input[name='userTel']").val())) {
            $("#uspan").css("display", "none");
        }
    })


    $('#固定电话').on('change', function() {
        var fixtel = /\d{3}-\d{8}|\d{4}-\d{7}/;
        if (!fixtel.test($("input[name='fixedTel']").val())) {
            $("#fspan").show();
        }
        if (fixtel.test($("input[name='fixedTel']").val())) {
            $("#fspan").css("display", "none");
        }
    })


    $('#QQ号').on('change', function() {
        var qq = /[1-9][0-9]{4,}/;
        if (!qq.test($("input[name='companyQq']").val())) {
            $("#qspan").show();
        }
        if (qq.test($("input[name='companyQq']").val())) {
            $("#qspan").css("display", "none");
        }
    })


    $('#公司邮箱').on('change', function() {
     var email = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
     if (!email.test($("input[name='companyEmail']").val())) {
         $("#espan").show();
     }
     if (email.test($("input[name='companyEmail']").val())) {
         $("#espan").css("display","none");
     }






 })
</script>


<script type="text/javascript">
    function tiaozzz() {
        window.location.href='admininfo';
    }

    function sure(){
        if(confirm("确定保存吗？")){

            if($("#lespan").css("display")!="none"){
                alert("姓名只能是中文或英文！")
                return false;
            }

            if($("#espan").css("display")!="none"){
                alert("邮箱格式不合格！")
                return false;
            }

            if($("#lspan").css("display")!="none"){
                alert("法人手机号格式不合格！")
                return false;
            }
            if($("#uspan").css("display")!="none"){
                alert("用户手机号格式不合格！")
                return false;
            }

            if($("#fspan").css("display")!="none"){
                alert("固定电话格式不合格！")
                return false;
            }

            if($("#qspan").css("display")!="none"){
                alert("qq号格式不合格！")
                return false;
            }

        }
        else{
            return false;
        }
    }


</script>
</body>
<script th:src="@{/erp/js/company.js}"></script>
<script type="text/javascript">
    //头像上传
    $(function () {

        if($('#imghead').attr("src").length==0){
            $('#imghead').attr("src", "erp/images/user.png");
        }
        if($('#cimage').attr("src").length==0){
            $('#cimage').attr("src", "erp/images/user.png");
        }

        //头像呗点击
        $('#imghead').click(function () {
            $('#imghead2').click();
        })

        //值改变后
        $('#imghead2').change(function () {
            //上传
            console.log("上传");
            $.ajax({
                type: 'post',
                url: "/resource/uploadImg",
                data: new FormData($('#head-form')[0]),
                cache: false,
                processData: false,
                contentType: false,
            }).success(function (data) {
                $('#headImg').val(data);
                $('#imghead2').val();
                $('#imghead').attr("src", data);
            }).error(function () {
                alert("上传失败");
            });

        })
    })


    function member_edit() {
        layer.open({
            type: 1,
            title: '手机号改绑',
            maxmin: true,
            shadeClose: false, //点击遮罩关闭层
            area: ['600px', ''],
            content: $('#edit_menber_style'),
            btn: ['绑定', '取消'],
        });
    }



    $(function () {
        var ue = UE.getEditor('editor');
        ue.ready(function() {
            ue.setContent($('#premarks').val(), false);
        });
    });

    function setting() {
        layer.confirm('确认要使用吗？', function (index) {
            layer.msg('已使用!', {icon: 1, time: 1000});
        });
        var valu = document.getElementById("result_").value;
        document.getElementById("value1").value = valu;
        document.getElementById("value2").value = valu;

    }


    var map = new BMap.Map("container");
    map.centerAndZoom("宁波", 12);
    map.enableScrollWheelZoom();    //启用滚轮放大缩小，默认禁用
    map.enableContinuousZoom();    //启用地图惯性拖拽，默认禁用

    map.addControl(new BMap.NavigationControl());  //添加默认缩放平移控件
    map.addControl(new BMap.OverviewMapControl()); //添加默认缩略地图控件
    map.addControl(new BMap.OverviewMapControl({isOpen: true, anchor: BMAP_ANCHOR_BOTTOM_RIGHT}));   //右下角，打开

    map.addEventListener("click", function (e) {   //单击地图，形成折线覆盖物

        document.getElementById("result_").value = e.point.lng + "," + e.point.lat;

    });

    var localSearch = new BMap.LocalSearch(map);
    localSearch.enableAutoViewport(); //允许自动调节窗体大小
    function searchByStationName() {
        map.clearOverlays();//清空原来的标注
        var keyword = document.getElementById("text_").value;
        localSearch.setSearchCompleteCallback(function (searchResult) {
            var poi = searchResult.getPoi(0);
            document.getElementById("result_").value = poi.point.lng + "," + poi.point.lat;
            map.centerAndZoom(poi.point, 13);
            var marker = new BMap.Marker(new BMap.Point(poi.point.lng, poi.point.lat));  // 创建标注，为要查询的地方对应的经纬度
            map.addOverlay(marker);
            var content = document.getElementById("text_").value + "<br/><br/>经度：" + poi.point.lng + "<br/>纬度：" + poi.point.lat;
            var infoWindow = new BMap.InfoWindow("<p style='font-size:14px;'>" + content + "</p>");
            marker.addEventListener("click", function () {
                this.openInfoWindow(infoWindow);
            });
            // marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
        });
        localSearch.search(keyword);
    }

</script>
</html>

